package com.pl.grainmall.order.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.pl.common.to.mq.SeckillOrderTo;
import com.pl.common.utils.PageUtils;
import com.pl.grainmall.order.entity.OrderEntity;
import com.pl.grainmall.order.vo.*;

import java.util.Map;
import java.util.concurrent.ExecutionException;

/**
 * 订单
 *
 * @author longzer
 * @email 2226185859@qq.com
 * @date 2022-04-26 21:20:11
 */
public interface OrderService extends IService<OrderEntity> {

    PageUtils queryPage(Map<String, Object> params);

    /**
     * 订单确认也返回需要用的数据
     * @return
     */
    OrderConfirmVo confirmOrder() throws ExecutionException, InterruptedException;

    //下单 //下单：去创建订单；验令牌，验价格，锁库存 。。。。
    SubmitOrderResponseVo submitOrder(OrderSubmitVo vo);

    /**
     * 按照订单号获取订单状态
     * @param orderSn
     * @return
     */
    OrderEntity getOrderByOrderSn(String orderSn);

    void closeOrder(OrderEntity entity);

    /**
     * 获取当前订单的支付消息
     * @param orderSn 订单号
     * @return
     */
    PayVo getOrderPay(String orderSn);

    /**
     * 查出当前用户的订单数据
     * @param params
     * @return
     */
    PageUtils queryPageWithItem(Map<String, Object> params);


    String handlePayResult(PayAsyncVo vo);

    void createSeckillOrder(SeckillOrderTo seckillOrderTo);
}

